const fs = require('fs')
const path = require('path')
fs.readFile(path.resolve(__dirname,'../font_3104622_9fy89p5exsn/iconfont.css'),'utf8',(err,data)=>{
    let labels = []
    let index = 0
    let labelMap = {}
    data.replace(/icon-(.+?):/g,function(){
        labels.push(arguments[1])
    })
    data.replace(/content: "(.+?)"/g,function(){
        let newstr = arguments[1].toString().slice(0,1)+'u'+arguments[1].toString().slice(1)
        labelMap[labels[index++]] = JSON.stringify(JSON.parse('{"ustr": "'+ newstr +'"}')).slice(9,10)
    })
    let output = ` export const labels = ${JSON.stringify(labels)} \n\r export const labelMap = ${JSON.stringify(labelMap)}`
    fs.writeFile(path.resolve(__dirname,'../src/common/labels.js',),output,function(){
        console.log( '输出完成')
    })
})